# 用 break 可以优化为,当输入 bye 时，结束输入
def test_break():
    data=[]
    while True:
        d = input("请输入数据：")
        if d == "bye":
            break
        data.append(d)
        print(data)
def test_continue():
    for i in range(10):
        print("*" * 10)
        print("i=",i)
        if i % 3 == 0:
            continue
        print("i*10= ", i*10)
def test_else():
    for i in range(5):
        print(i)
    else:
        print("Over")

def test_else2():
    names = ["tom", "jack", "rose", "tony"]

    inName = input("请输入要查找的姓名：")

    # 不使用Else形式
    flag = False
    for name in names:
        if name == inName:
            print("找到了")
            flag = True
            break
    if not flag:
        print("没找到")

    # 使用Else形式
    for name in names:
        if name == inName:
            print("找到了")
            break
    else:
        print("没找到")


if __name__ == '__main__':
    test_continue()
    test_else()
    test_else2()
